package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.junzhiit.nengji.cms.service.ChargeRuleService;
import com.junzhiit.nengji.cms.web.vo.ChargeRuleVO;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/charge/rule")
public class ChargeRuleController {

	@Autowired
	private ChargeRuleService chargeRuleService;
	
	@ApiOperation("查询所有储值规则")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> findAll(DataTablesParamVO dtp, ChargeRuleVO chargeRuleVO) {
		return chargeRuleService.findAll(dtp, chargeRuleVO);
	}
	
	@ApiOperation("添加储值规则")
	@RequestMapping(value="/add",method = RequestMethod.POST)
	public ResultVO add(ChargeRuleVO chargeRuleVO) {
		return chargeRuleService.add(chargeRuleVO);
	}
	
	@ApiOperation("根据ID查询储值规则")
	@RequestMapping(value="/find",method = RequestMethod.GET)
	public ResultVO findById(String id) {
		return chargeRuleService.findById(id);
	}
	
	@ApiOperation("修改储值规则")
	@RequestMapping(value="/update",method = RequestMethod.PUT)
	public ResultVO update(ChargeRuleVO chargeRuleVO) {
		return chargeRuleService.update(chargeRuleVO);
	}
	
	@ApiOperation("删除储值规则")
	@RequestMapping(value="/del",method = RequestMethod.DELETE)
	public ResultVO del(String id) {
		return chargeRuleService.del(id);
	}
}
